import Wechat from '../wechat-cli'
import Oauth from '../wechat-cli/oauth'
import mongoose from 'mongoose'
import config from '../config'
const Token = mongoose.model('Token')
const Ticket = mongoose.model('Ticket')
const opts = {
  getAccessToken: async () => await Token.getAccessToken(),
  saveAccessToken: async (data) => await Token.saveAccessToken(data),
  getTicket: async (token) => await Ticket.getTicket(token),
  saveTicket: async (data) => await Ticket.saveTicket(data),
  appID: config.wechat.appID,
  appSecret: config.wechat.appSecret,
  token: config.wechat.token
}
export const wechatCli = () => new Wechat(opts)

export const wechatOauth = () => new Oauth(opts)
